package com.cx.util;

import com.cx.pojo.LogMessage;
import com.cx.service.LogMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


import java.util.Date;

/**
 * @Description GroupOneproject-IntelliJ IDEA
 * @Author Pyc
 * @Date 2020/5/27 15:35
 * @Version 1.0
 */

@Component
public class InsertLog {

    @Autowired
    LogMessageService logMessageService;

    public int insert(int uid,String type,String context){
        LogMessage logMessage = new LogMessage();
        logMessage.setUserId(uid);
        logMessage.setType(type);
        logMessage.setContext(context);
        logMessage.setDate(new Date());
        logMessage.setStatus(1);
        return logMessageService.insertMessage(logMessage);
    }
}
